Python for Data Science: Comprehensive Guide to Data Science with Python by Campbell Alex
Author:Campbell, Alex [Campbell, Alex]
Language: eng
Format: epub, azw3
Published: 2021-06-17T16:00:00+00:00
3.5
1
0
0
2.0
0
1
0
6.7
0
0
1
As we said earlier, a dummy variable is used to indicate whether something is there or not. Commonly, they are used as substitutes, allowing us to take qualitative data and do quantitative analysis. From that table, we can easily see that New York is 3.5, split as follows:
New York â 1
California â 0
Florida â 0
This is a very easy way of representing text categories into numeric values.
However, you need to watch out for the dummy variable trap. In this trap, an extra variable exists â this could have been eliminated because the other variables could predict it. In the above example, when the New York and California columns are zero, you automatically know it is Florida. Even with two variables, you can know the State.
Going back to our Startups example, we can get around this trap by having the following in the code:
X = X[:, 1:]
Here's what we have so far:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('50_Startups.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, 4].values
Have a look at the data:
dataset.head()
Download
Python for Data Science: Comprehensive Guide to Data Science with Python by Campbell Alex.azw3
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Ada | Ajax |
Assembly Language Programming | Borland Delphi |
C & C++ | C# |
CSS | Compiler Design |
Compilers | DHTML |
Debugging | Delphi |
Fortran | Java |
Lisp | Perl |
Prolog | Python |
RPG | Ruby |
Swift | Visual Basic |
XHTML | XML |
XSL |
Hello! Python by Anthony Briggs(9911)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9794)
The Mikado Method by Ola Ellnestam Daniel Brolund(9775)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8292)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7775)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7758)
Grails in Action by Glen Smith Peter Ledbrook(7693)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Windows APT Warfare by Sheng-Hao Ma(6782)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6509)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6376)
Kotlin in Action by Dmitry Jemerov(5061)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4315)
Functional Programming in JavaScript by Mantyla Dan(4037)
Solidity Programming Essentials by Ritesh Modi(3975)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3761)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3702)
The Ultimate iOS Interview Playbook by Avi Tsadok(3679)
